From d6780cf3dad729c69a102ba2940188cf1e6bcbf4 Mon Sep 17 00:00:00 2001 From: zephex Date: Sat, 20 Apr 2024 13:34:53 +0530 Subject: idk whats happening --- .../manga/[title]/[id]/[read]/currentReading.jsx | 68 ++-- src/app/manga/[title]/[id]/[read]/download.jsx | 42 +- src/app/manga/[title]/[id]/[read]/page.jsx | 112 +++--- src/app/manga/[title]/[id]/[read]/read.module.css | 128 +++--- src/app/manga/[title]/[id]/buttons.jsx | 108 ++--- src/app/manga/[title]/[id]/info.module.css | 446 ++++++++++----------- src/app/manga/[title]/[id]/page.jsx | 272 ++++++------- 7 files changed, 588 insertions(+), 588 deletions(-) (limited to 'src/app/manga/[title]/[id]') diff --git a/src/app/manga/[title]/[id]/[read]/currentReading.jsx b/src/app/manga/[title]/[id]/[read]/currentReading.jsx index 0050d61..5205ea9 100644 --- a/src/app/manga/[title]/[id]/[read]/currentReading.jsx +++ b/src/app/manga/[title]/[id]/[read]/currentReading.jsx @@ -1,34 +1,34 @@ -"use client"; - -import styles from "./read.module.css"; -import { useEffect } from "react"; - -function get_current_info(title) { - let req = {}; - - useEffect(() => { - const data = JSON.parse(localStorage.getItem("mangaData")); - data.watchHis.forEach((element) => { - if (element.title === title) { - req.chapter = element.chapter; - req.volume = element.volume; - } - }); - }, []); - - return req || false; -} - -export default function Current({ name: title }) { - let data = get_current_info(title); - if (!data) { - return; - } - - return ( -
-

{data.chapter}

-

{data.volume}

-
- ); -} +"use client"; + +import styles from "./read.module.css"; +import { useEffect } from "react"; + +function get_current_info(title) { + let req = {}; + + useEffect(() => { + const data = JSON.parse(localStorage.getItem("mangaData")); + data.watchHis.forEach((element) => { + if (element.title === title) { + req.chapter = element.chapter; + req.volume = element.volume; + } + }); + }, []); + + return req || false; +} + +export default function Current({ name: title }) { + let data = get_current_info(title); + if (!data) { + return; + } + + return ( +
+

{data.chapter}

+

{data.volume}

+
+ ); +} diff --git a/src/app/manga/[title]/[id]/[read]/download.jsx b/src/app/manga/[title]/[id]/[read]/download.jsx index e7a20ee..bddf6d3 100644 --- a/src/app/manga/[title]/[id]/[read]/download.jsx +++ b/src/app/manga/[title]/[id]/[read]/download.jsx @@ -1,21 +1,21 @@ -"use client"; - -import styles from "./read.module.css"; - -export default function DownloadManga({ chapterId: id }) { - return ( -
- - alert( - "Downloads are not instant. It might take some time to prepare your file. Thank you for your patience" - ) - } - > - - -
- ); -} +"use client"; + +import styles from "./read.module.css"; + +export default function DownloadManga({ chapterId: id }) { + return ( +
+ + alert( + "Downloads are not instant. It might take some time to prepare your file. Thank you for your patience" + ) + } + > + + +
+ ); +} diff --git a/src/app/manga/[title]/[id]/[read]/page.jsx b/src/app/manga/[title]/[id]/[read]/page.jsx index dbba6e0..a4181d7 100644 --- a/src/app/manga/[title]/[id]/[read]/page.jsx +++ b/src/app/manga/[title]/[id]/[read]/page.jsx @@ -1,56 +1,56 @@ -import styles from "./read.module.css"; -import Image from "next/image"; -import DownloadManga from "./download"; - -export default async function Read({ params }) { - const chapterId = params.read; - const results = await getPages(chapterId); - const image_base_url = results.baseUrl + "/data/" + results.chapter.hash; - - if (results.length === 0) { - return ( -
-

- This chapter has no content. Please check the next chapter. -

-
- ); - } - - let images = []; - for (var i = 0; i < results.chapter.data.length; i++) { - var imgUrl = image_base_url + "/" + results.chapter.data[i]; - images.push(imgUrl); - } - - return ( -
-
- -

Total pages: {images.length}

- {images && - images.map((item, index) => ( -
- Pages -

{index + 1}

-
- ))} -
-
- ); -} - -async function getPages(id) { - const res = await fetch(`https://api.mangadex.org/at-home/server/${id}`); - const data = await res.json(); - return data; -} +import styles from "./read.module.css"; +import Image from "next/image"; +import DownloadManga from "./download"; + +export default async function Read({ params }) { + const chapterId = params.read; + const results = await getPages(chapterId); + const image_base_url = results.baseUrl + "/data/" + results.chapter.hash; + + if (results.length === 0) { + return ( +
+

+ This chapter has no content. Please check the next chapter. +

+
+ ); + } + + let images = []; + for (var i = 0; i < results.chapter.data.length; i++) { + var imgUrl = image_base_url + "/" + results.chapter.data[i]; + images.push(imgUrl); + } + + return ( +
+
+ +

Total pages: {images.length}

+ {images && + images.map((item, index) => ( +
+ Pages +

{index + 1}

+
+ ))} +
+
+ ); +} + +async function getPages(id) { + const res = await fetch(`https://api.mangadex.org/at-home/server/${id}`); + const data = await res.json(); + return data; +} diff --git a/src/app/manga/[title]/[id]/[read]/read.module.css b/src/app/manga/[title]/[id]/[read]/read.module.css index 420fff8..0133232 100644 --- a/src/app/manga/[title]/[id]/[read]/read.module.css +++ b/src/app/manga/[title]/[id]/[read]/read.module.css @@ -1,65 +1,65 @@ -.Main { - margin: 80px auto; -} - -.Image { - display: flex; - flex-direction: column; - align-items: center; - background-color: #1b1b1b; - border-radius: 10px; - width: 50%; - margin: 10px auto; -} - -.ImageContainer img { - max-width: auto; - height: auto; - border-radius: 5px; - margin-top: 10px; -} - -.ImageContainer p { - text-align: center; - color: white; - font-family: "Atkinson Hyperlegible", serif; - font-size: 16px; - margin: 5px; -} - -.NotFound { - text-align: center; - color: white; - font-family: "Atkinson Hyperlegible", serif; - font-size: 20px; -} - -.DownloadMain { - text-align: center; -} - -.DownloadMain button { - border: none; - outline: none; - border-radius: 5px; - padding: 5px; - font-family: "Atkinson Hyperlegible", serif; - font-size: 16px; - background-color: var(--light-green); - cursor: pointer; -} - -.DownloadMain button:hover { - background-color: var(--pastel-red); -} - -@media screen and (max-width: 768px) { - .ImageContainer img { - width: 95%; - align-items: center; - } - - .Image { - width: 100%; - } +.Main { + margin: 80px auto; +} + +.Image { + display: flex; + flex-direction: column; + align-items: center; + background-color: #1b1b1b; + border-radius: 10px; + width: 50%; + margin: 10px auto; +} + +.ImageContainer img { + max-width: auto; + height: auto; + border-radius: 5px; + margin-top: 10px; +} + +.ImageContainer p { + text-align: center; + color: white; + font-family: "Atkinson Hyperlegible", serif; + font-size: 16px; + margin: 5px; +} + +.NotFound { + text-align: center; + color: white; + font-family: "Atkinson Hyperlegible", serif; + font-size: 20px; +} + +.DownloadMain { + text-align: center; +} + +.DownloadMain button { + border: none; + outline: none; + border-radius: 5px; + padding: 5px; + font-family: "Atkinson Hyperlegible", serif; + font-size: 16px; + background-color: var(--light-green); + cursor: pointer; +} + +.DownloadMain button:hover { + background-color: var(--pastel-red); +} + +@media screen and (max-width: 768px) { + .ImageContainer img { + width: 95%; + align-items: center; + } + + .Image { + width: 100%; + } } \ No newline at end of file diff --git a/src/app/manga/[title]/[id]/buttons.jsx b/src/app/manga/[title]/[id]/buttons.jsx index 4c11705..a6c8d75 100644 --- a/src/app/manga/[title]/[id]/buttons.jsx +++ b/src/app/manga/[title]/[id]/buttons.jsx @@ -1,54 +1,54 @@ -"use client"; - -import styles from "./info.module.css"; -import Link from "next/link"; -import { storeLocal } from "../../history/storeData"; - -export default function Buttons({ content: data }) { - function store_to_local(title, chapter, volume, image, id, id2) { - let data = { - title: title, - chapter: chapter, - volume: volume, - image: image, - id: id, - mangaId: id2, - }; - storeLocal(data); - } - - return ( -
- {data.chapters && - data.chapters.map((item, index) => { - if (item.pages !== 0) { - return ( - { - store_to_local( - data.title.english || data.title.romaji, - parseInt(item.chapterNumber), - parseInt(item.volumeNumber), - data.image, - item.id, - data.id - ); - }} - > - - - ); - } - })} -
- ); -} +"use client"; + +import styles from "./info.module.css"; +import Link from "next/link"; +import { storeLocal } from "../../history/storeData"; + +export default function Buttons({ content: data }) { + function store_to_local(title, chapter, volume, image, id, id2) { + let data = { + title: title, + chapter: chapter, + volume: volume, + image: image, + id: id, + mangaId: id2, + }; + storeLocal(data); + } + + return ( +
+ {data.chapters && + data.chapters.map((item, index) => { + if (item.pages !== 0) { + return ( + { + store_to_local( + data.title.english || data.title.romaji, + parseInt(item.chapterNumber), + parseInt(item.volumeNumber), + data.image, + item.id, + data.id + ); + }} + > + + + ); + } + })} +
+ ); +} diff --git a/src/app/manga/[title]/[id]/info.module.css b/src/app/manga/[title]/[id]/info.module.css index b1b76f4..bc22f49 100644 --- a/src/app/manga/[title]/[id]/info.module.css +++ b/src/app/manga/[title]/[id]/info.module.css @@ -1,224 +1,224 @@ -.MangaInfoContainer { - margin: 68px auto; -} - -.MangaHero { - display: flex; - flex-direction: column; - justify-content: center; -} - -.TitleContainer { - display: flex; - justify-content: space-between; - align-items: center; - padding: 5px; - background-color: #2c2c2c9c; - backdrop-filter: blur(5px); - -} - -.TitleContainer p { - font-family: "Lexend Deca", serif; - font-size: 40px; - font-weight: 1000; -} - -.TitleContainer img { - border-radius: 10px; - margin-left: 5px; -} - -.MangaDescription { - color: white; - font-family: "Atkinson Hyperlegible", serif; - max-width: 98%; - margin: -10px auto; -} - -.Description h2 { - font-family: "Lexend Deca", serif; - color: gray; -} - -.Description p { - margin-top: -10px; -} - -.MangaReleaseYear { - margin-top: 10px; - font-family: "Poppins", serif; -} - -.GenreContainer { - margin-top: 5px; - display: flex; - align-items: center; - font-family: "Poppins", serif; -} - -.GenreText { - color: var(--neon-green); -} - -.GenreContainer { - margin-top: 10px; -} - -.genres { - display: flex; - align-items: center; - overflow-x: auto; -} - -.MangaGenre { - background-color: #5f5f5f5d; - border-radius: 5px; - padding: 2px 5px; - cursor: pointer; - margin: 2px; -} - -.MangaRatings { - display: flex; - margin-top: 10px; - font-family: "Poppins", serif; - /* justify-content: center; */ -} - -.MangaRatings span { - margin-right: 2px; - margin-left: 2px; - color: var(--light-green); -} - -.CharactersContainer { - max-width: 98%; - margin: 20px auto; -} - -.CharactersContainer h2 { - color: gray; - font-family: "Lexend Deca", serif; -} - -.Character { - display: flex; - flex-direction: row; - overflow-x: auto; - margin-top: -10px; -} - -.Character::-webkit-scrollbar { - height: 5px; -} - -.Character::-webkit-scrollbar-thumb { - background-color: #31363F; - border-radius: 5px; -} - -.CharacterEntry { - display: flex; - flex-direction: column; - align-items: center; - width: auto; - margin: 5px; -} - -.CharacterEntry p { - margin: 10px auto; - text-align: center; - width: 110px; - color: white; - font-family: "Atkinson Hyperlegible", serif; -} - -.CharacterEntry img { - border-radius: 10px; -} - -/* Chapters Buttons */ - -.Chapters { - display: flex; - align-items: center; - justify-content: space-between; - max-width: 90%; - margin: 20px auto; -} - -.ChapterTitle { - color: white; - font-family: "Lexend Deca", serif; - font-size: 32px; -} - -.ChapterContainer { - width: 50dvw; - text-align: center; - height: 300px; - overflow-y: auto; -} - -.ChapterContainer::-webkit-scrollbar { - width: 5px; - height: 0px; -} - -.ChapterContainer::-webkit-scrollbar-thumb { - background-color: #31363F; - border-radius: 5px; -} - -.ChapterContainer button { - width: 130px; - height: auto; - padding: 10px; - margin: 5px; - border-radius: 5px; - font-size: 16px; - border: none; - outline: none; - color: white; - background-color: #3d3d3d; - cursor: pointer; - transition: background-color 100ms ease-in-out; -} - -.ChapterContainer button p { - font-family: "Atkinson Hyperlegible", serif; - margin: 2px; -} - -.ChapterContainer button:hover { - background-color: #1f1f1f; - transition: background-color 50ms ease-in -} - -.ChapterContainer button:focus { - opacity: 0.7; - transition: transform 0.2s linear; - background-color: var(--pastel-red); - transform: scale(0.9); -} - -@media screen and (max-width: 768px) { - .MangaInfoContainer { - max-width: 100%; - } - - .TitleContainer p { - font-size: 28px; - } - - .ChapterContainer button { - width: 120px; - - } - - .ChapterContainer button p { - font-size: 14px; - } - +.MangaInfoContainer { + margin: 68px auto; +} + +.MangaHero { + display: flex; + flex-direction: column; + justify-content: center; +} + +.TitleContainer { + display: flex; + justify-content: space-between; + align-items: center; + padding: 5px; + background-color: #2c2c2c9c; + backdrop-filter: blur(5px); + +} + +.TitleContainer p { + font-family: "Lexend Deca", serif; + font-size: 40px; + font-weight: 1000; +} + +.TitleContainer img { + border-radius: 10px; + margin-left: 5px; +} + +.MangaDescription { + color: white; + font-family: "Atkinson Hyperlegible", serif; + max-width: 98%; + margin: -10px auto; +} + +.Description h2 { + font-family: "Lexend Deca", serif; + color: gray; +} + +.Description p { + margin-top: -10px; +} + +.MangaReleaseYear { + margin-top: 10px; + font-family: "Poppins", serif; +} + +.GenreContainer { + margin-top: 5px; + display: flex; + align-items: center; + font-family: "Poppins", serif; +} + +.GenreText { + color: var(--neon-green); +} + +.GenreContainer { + margin-top: 10px; +} + +.genres { + display: flex; + align-items: center; + overflow-x: auto; +} + +.MangaGenre { + background-color: #5f5f5f5d; + border-radius: 5px; + padding: 2px 5px; + cursor: pointer; + margin: 2px; +} + +.MangaRatings { + display: flex; + margin-top: 10px; + font-family: "Poppins", serif; + /* justify-content: center; */ +} + +.MangaRatings span { + margin-right: 2px; + margin-left: 2px; + color: var(--light-green); +} + +.CharactersContainer { + max-width: 98%; + margin: 20px auto; +} + +.CharactersContainer h2 { + color: gray; + font-family: "Lexend Deca", serif; +} + +.Character { + display: flex; + flex-direction: row; + overflow-x: auto; + margin-top: -10px; +} + +.Character::-webkit-scrollbar { + height: 5px; +} + +.Character::-webkit-scrollbar-thumb { + background-color: #31363F; + border-radius: 5px; +} + +.CharacterEntry { + display: flex; + flex-direction: column; + align-items: center; + width: auto; + margin: 5px; +} + +.CharacterEntry p { + margin: 10px auto; + text-align: center; + width: 110px; + color: white; + font-family: "Atkinson Hyperlegible", serif; +} + +.CharacterEntry img { + border-radius: 10px; +} + +/* Chapters Buttons */ + +.Chapters { + display: flex; + align-items: center; + justify-content: space-between; + max-width: 90%; + margin: 20px auto; +} + +.ChapterTitle { + color: white; + font-family: "Lexend Deca", serif; + font-size: 32px; +} + +.ChapterContainer { + width: 50dvw; + text-align: center; + height: 300px; + overflow-y: auto; +} + +.ChapterContainer::-webkit-scrollbar { + width: 5px; + height: 0px; +} + +.ChapterContainer::-webkit-scrollbar-thumb { + background-color: #31363F; + border-radius: 5px; +} + +.ChapterContainer button { + width: 130px; + height: auto; + padding: 10px; + margin: 5px; + border-radius: 5px; + font-size: 16px; + border: none; + outline: none; + color: white; + background-color: #3d3d3d; + cursor: pointer; + transition: background-color 100ms ease-in-out; +} + +.ChapterContainer button p { + font-family: "Atkinson Hyperlegible", serif; + margin: 2px; +} + +.ChapterContainer button:hover { + background-color: #1f1f1f; + transition: background-color 50ms ease-in +} + +.ChapterContainer button:focus { + opacity: 0.7; + transition: transform 0.2s linear; + background-color: var(--pastel-red); + transform: scale(0.9); +} + +@media screen and (max-width: 768px) { + .MangaInfoContainer { + max-width: 100%; + } + + .TitleContainer p { + font-size: 28px; + } + + .ChapterContainer button { + width: 120px; + + } + + .ChapterContainer button p { + font-size: 14px; + } + } \ No newline at end of file diff --git a/src/app/manga/[title]/[id]/page.jsx b/src/app/manga/[title]/[id]/page.jsx index d743f4d..ffd962d 100644 --- a/src/app/manga/[title]/[id]/page.jsx +++ b/src/app/manga/[title]/[id]/page.jsx @@ -1,136 +1,136 @@ -import styles from "./info.module.css"; -import Image from "next/image"; -import Buttons from "./buttons"; -import { redirect } from "next/navigation"; -import { FaStar } from "react-icons/fa"; -import { PreFetchChaterLinks } from "../../cacher"; - -export default async function MangaInfo({ params }) { - const id = params.id; - const data = await getMangaInfo(id); - - if (data.message) { - redirect("/404"); - } - - PreFetchChaterLinks(data.chapters); - - return ( -
- {data && ( -
-
-
-

- {data.title["english"] || data.title["romaji"]} -

- Manga Poster -
-
- -
-
-

Description

-

{data.description.split(" -

- -
- - Started on: {data.startDate["day"]}- - {data.startDate["month"]}- - {data.startDate["year"]} - - - | - - - Ended on: {data.endDate["day"]}- - {data.endDate["month"]}-{data.endDate["year"]} - -
- -
- Genres: -
- {data.genres && - data.genres.map((item, index) => ( - - {item} - - ))} -
-
- -
- Ratings: {data.rating / 10} - - - -
-
- -
-

Characters

-
- {data.characters && - data.characters.map((item, index) => ( -
- Character Poster -

- {item.name.full} ({item.role}) -

-
- ))} -
-
-
-

- Chapters & Volumes -

- -
-
- )} -
- ); -} - -async function getMangaInfo(id) { - const res = await fetch( - `https://consumet-jade.vercel.app/meta/anilist-manga/info/${id}?provider=mangadex`, - { next: { revalidate: 86400 } } - ); - const data = await res.json(); - return data; -} +import styles from "./info.module.css"; +import Image from "next/image"; +import Buttons from "./buttons"; +import { redirect } from "next/navigation"; +import { FaStar } from "react-icons/fa"; +import { PreFetchChaterLinks } from "../../cacher"; + +export default async function MangaInfo({ params }) { + const id = params.id; + const data = await getMangaInfo(id); + + if (data.message) { + redirect("/404"); + } + + PreFetchChaterLinks(data.chapters); + + return ( +
+ {data && ( +
+
+
+

+ {data.title["english"] || data.title["romaji"]} +

+ Manga Poster +
+
+ +
+
+

Description

+

{data.description.split(" +

+ +
+ + Started on: {data.startDate["day"]}- + {data.startDate["month"]}- + {data.startDate["year"]} + + + | + + + Ended on: {data.endDate["day"]}- + {data.endDate["month"]}-{data.endDate["year"]} + +
+ +
+ Genres: +
+ {data.genres && + data.genres.map((item, index) => ( + + {item} + + ))} +
+
+ +
+ Ratings: {data.rating / 10} + + + +
+
+ +
+

Characters

+
+ {data.characters && + data.characters.map((item, index) => ( +
+ Character Poster +

+ {item.name.full} ({item.role}) +

+
+ ))} +
+
+
+

+ Chapters & Volumes +

+ +
+
+ )} +
+ ); +} + +async function getMangaInfo(id) { + const res = await fetch( + `https://consumet-jade.vercel.app/meta/anilist-manga/info/${id}?provider=mangadex`, + { next: { revalidate: 86400 } } + ); + const data = await res.json(); + return data; +} -- cgit v1.2.3